<?php

/**
 * This form is for mapping all state and cities
 */
class Admin_Form_Manageall extends Zend_Form {

    public function init() {
        $stateDb = new Ads_Model_State();
        $stateArray = $stateDb->fetchAll();
        $cityDb = new Ads_Model_City();
        $cityArray = $cityDb->getCityStated();

        $this->setMethod("post");

        $states = new Zend_Form_Element_Select("state");
        $states->setLabel("Select State")
                ->setRequired();
        foreach ($stateArray as $state) {
            $states->addMultiOption($state->id, $state->name);
        }


        $cities = new Zend_Form_Element_Multiselect("city");
        $cities->setLabel("Choose Cities")
                ->setAttribs(array('size'=>'50'))
                ->setRequired();
        foreach ($cityArray as $city) {
            $cities->addMultiOption($city->id, $city->name);
        }


        $submit = new Zend_Form_Element_Submit("submit");
        $submit->setLabel("Save")
                ->setAttribs(array('class' => 'btn btn-success'));


        $this->addElements(array($states, $cities, $submit));
    }

}

